import { createStore } from 'vuex';
import category from './modules/category';
import user from './modules/user';
import createPersistedstate from 'vuex-persistedstate';

export default createStore({
    state: {
        // phone_number: "",
        // password: "",
        // islogin: false,//登录状态
        // cookie: '',
    },
    mutations: {
        // register(state, provider) {
        //     state.islogin = true;
        //     state.phone_number = provider
        //     console.log(state)
        // },
        // login(state, provider) {
        //     console.log(state)
        //     console.log(provider)
        //     state.islogin = true
        //     state.phone_number = provider
        //     state.apikey = provider.apikey
        // },
        // loginout(state) {
        //     state.islogin = false
        //     state.apikey = ''
        // },
    },
    modules:{
        category,
        user,
    },
    //配置插件，使模块内容存储到本地
    plugins:[
        createPersistedstate({
            key:'ceshi',
            path:["user","category"],
        })
    ]
});

